﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pipes.Queries.Model.Query
{
  public class Script : Parser.IQueryVisitable
  {
    private IList<IStatement> _stmts = new List<IStatement>();

    public IList<IStatement> Statements
    {
      get
      {
        return _stmts;
      }
    }

    public override string ToString()
    {
      var builder = new StringBuilder();
      for (var i = 0; i < _stmts.Count; i++)
      {
        if (i > 0) builder.AppendLine();
        builder.Append(_stmts[i].ToString());
      }
      return builder.ToString();
    }

    public void Visit(Parser.IQueryVisitor visitor)
    {
      visitor.Visit(this);
    }
  }
}
